package models

import "time"

type BusinessRule struct {
	ID            string       `gorm:"primaryKey"`
	TenantID      string       `gorm:"index"`
	RuleName      string       `gorm:"size:255"`
	ConditionExpr string       `gorm:"type:text"`
	Actions       []RuleAction `gorm:"type:json"`
	TriggerEvent  string       `gorm:"size:255"`
	Scope         string       `gorm:"size:50"`
	Status        bool
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

type RuleAction struct {
	ActionType string      `json:"action_type"`
	Target     string      `json:"target"`
	Parameters interface{} `json:"parameters"`
	Payload    interface{} `json:"payload"` // Add this field
}

type BusinessRuleHistory struct {
	ID            string       `gorm:"primaryKey"`
	TenantID      string       `gorm:"index"`
	RuleID        string       `gorm:"index"`
	RuleName      string       `gorm:"size:255"`
	ConditionExpr string       `gorm:"type:text"`
	Actions       []RuleAction `gorm:"type:json"`
	TriggerEvent  string       `gorm:"size:255"`
	Scope         string       `gorm:"size:50"`
	Status        bool
	CreatedAt     time.Time
	UpdatedAt     time.Time
	Prediction    string `gorm:"type:text"`
	Feedback      string `gorm:"type:text"`
}
